public interface ListInterface<I>
| Modifier and Type | Method and Description |
|---|---|
void |
add(I obj)
This method is called to add the specified object to the end of the list.
|
boolean |
add(I obj,
int index)
This method is called to add the specified object to the list at the given index.
|
boolean |
addSorted(I obj)
This method is called to add the specified object to the list in sorted order.
|
I |
get(int index)
This method is called to retrieve the object at the specified index.
|
boolean |
isEmpty()
This method is called to determine if the list is empty.
|
boolean |
remove(int index)
This method is called to remove the object at the specified index
|
void |
removeAll()
This method removes all objects from the list, making the list empty.
|
I |
replace(I obj,
int index)
This method is called to replace the element at the specified index with the specified
obj.
|
int |
size()
This method is called to obtain the count of elements in the list.
|
int size()
boolean isEmpty()
void add(I obj)
obj - A reference to the object to be added to the end of the list.
All objects being added to the list must implement the
Comparable interface.Comparableboolean add(I obj, int index)
obj - A reference to the object to be added to the list.
All objects being added to the list must implement the
Comparable interface.index - Indicates the position at which to add the specified object.
Using and index = 0, indicates that the object being added should
become the head of the list and should succeed even if
the list is currently empty.Comparableboolean addSorted(I obj)
obj - A reference to the obj being added, in sorted order,
to the list. All objects being added to the list must implement the
Comparable interface.ComparableI get(int index)
index - Indicates the position from which to retrieve the object.I replace(I obj, int index)
obj - A reference to the obj that will replace the current element in the list.index - Idicates the position in the list where the replacement should be made.boolean remove(int index)
index - Indicates the position from which to remove the object.void removeAll()